<?php
/**
 * Created by PhpStorm.
 * User: dapeng
 * Date: 2018/10/17
 * Time: 上午10:45
 */

namespace app\controllers\Project_1_0;

use Core\Controller;

class Cases extends Controller
{
    function __construct()
    {
        parent::__construct();
        //判断是否登陆过
        if (!isset($_SESSION['user'])){
            $this->error("您尚未登录","index.php?action=user&func=login");
            exit();
        }
    }

    function index(){
        $model =  new \app\models\Project_1_0\Cases();
        $res = $model->fetch_all();
        //注意该方法是经过二次封装的
        $this->assign("cases",$res);
        $this->diplay("case/index");
    }

    function search(){
        //获取页面传过来的查询条件
        $option = $_POST['option'];
        switch ($option)
        {
            case "案件号":{
                echo "案件号";
                break;
            }
            case "承办人":{
                echo "承办人";

                break;
            }
            case "状态":{
                echo "状态";

                break;
            }
            default:{

                break;
            }

        }

        $content = $_POST['content'];
        $cases = new \app\models\Project_1_0\Cases();
        $res = $cases->search($option,$content);
        $this->assign("cases",$res);
        $this->diplay("case/index");

    }
}